{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [ 1, 3, 5, 7, 9,  11, 13, 15, 17, 19, \n",
    "       21, 23, 25, 27, 29, 31, 33, 35, 37, 39,\n",
    "       41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'darwin'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import sys\n",
    ">>> sys.platform\n",
    "'darwin'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-2-2d4c8b60350f>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-2-2d4c8b60350f>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)\u001b[0m\n\u001b[1;37m        ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    ">>> print(sys.version)\n",
    "3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)\n",
    "[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/Users/HeadFirst/CodeExamples'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import os\n",
    ">>> os.getcwd()\n",
    "'/Users/HeadFirst/CodeExamples'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-11-91c4436961a6>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-11-91c4436961a6>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    'environ({'XPC_FLAGS': '0x0', 'HOME': '/Users/HeadFirst', 'TMPDIR': '/var/\u001b[0m\n\u001b[1;37m                       ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    ">>> os.environ\n",
    "'environ({'XPC_FLAGS': '0x0', 'HOME': '/Users/HeadFirst', 'TMPDIR': '/var/\n",
    "folders/18/t93gmhc546b7b2cngfhz10l00000gn/T/', ... 'PYTHONPATH': '/Applications/\n",
    "Python 3.4/IDLE.app/Contents/Resources', ... 'SHELL': '/bin/bash', 'USER':\n",
    "'HeadFirst'})'\n",
    ">>> os.getenv('HOME')\n",
    "'/Users/HeadFirst'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2015, 5, 31)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import datetime\n",
    ">>> datetime.date.today()\n",
    "datetime.date(2015, 5, 31)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2015"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.today().day\n",
    "31\n",
    ">>> datetime.date.today().month\n",
    "5\n",
    ">>> datetime.date.today().year\n",
    "2015"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2015-05-31'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.isoformat(datetime.date.today())\n",
    "'2015-05-31'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'23:55'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import time\n",
    ">>> time.strftime(\"%H:%M\")\n",
    "'23:55'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Sunday PM'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> time.strftime(\"%A %p\")\n",
    "'Sunday PM'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"I ♥ Python's <standard library>.\""
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import html\n",
    ">>> html.escape(\"This HTML fragment contains a <script>script</script> tag.\")\n",
    "'This HTML fragment contains a &lt;script&gt;script&lt;/script&gt; tag.'\n",
    ">>> html.unescape(\"I &hearts; Python's &lt;standard library&gt;.\")\n",
    "\"I ♥ Python's <standard library>.\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
